<template>
    <div class="good-item">
        <div style="">
            <!-- 图片 -->
            <div class="good-img">
                <a @click="openProduct(msg.productId)">
                    <!-- <img v-lazy="msg.productImageBig" :alt="msg.productName" :key="msg.productImageBig"> -->
                    <img src="../assets/img/001.jpg" alt="" />
                </a>
            </div>
            <!-- <h6 class="good-title" v-html="msg.productName">{{msg.productName}}</h6>
      <h3 class="sub-title ellipsis">{{msg.subTitle}}</h3> -->
            <h6 class="good-title" v-html="msg.productName">
                {{ msg.productName }}
            </h6>
            <h3 class="sub-title ellipsis">{{ msg.subTitle }}</h3>

            <div class="good-price pr">
                <div class="ds pa">
                    <a @click="openProduct(msg.productId)">
                        <button text="查看详情" style="margin: 0 5px"></button>
                    </a>
                    <y-button
                        text="加入购物车"
                        style="margin: 0 5px"
                        @btnClick="
                            addCart(
                                msg.productId,
                                msg.salePrice,
                                msg.productName,
                                msg.productImageBig
                            )
                        "
                        classStyle="main-btn"
                    ></y-button>
                </div>
                <p>
                    <span style="font-size:14px">￥</span
                    >{{ Number(msg.salePrice).toFixed(2) }}
                </p>
            </div>
        </div>
    </div>
</template>
<script>
export default {
    data() {
        return {
            goods: [
                {
                    id: 1,
                    name: "001",
                    class: "1",
                    src: "",
                    ps: "",
                },
            ],
        };
    },
};
</script>
<style lang="scss">
.good-item {
    background: #fff;
    width: 25%;
    transition: all 0.5s;
    height: 430px;
    &:hover {
        transform: translateY(-3px);
        box-shadow: 1px 1px 20px #999;
        .good-price p {
            display: none;
        }
        .ds {
            display: flex;
        }
    }
    .ds {
        width: 100%;
        display: none;
    }

    .good-img {
        img {
            margin: 50px auto 10px;
            display: block;
        }
    }
    .good-price {
        margin: 15px 0;
        height: 30px;
        text-align: center;
        line-height: 30px;
        color: #d44d44;
        font-family: Arial;
        font-size: 18px;
        font-weight: 700;
    }
    .good-title {
        line-height: 1.2;
        font-size: 16px;
        color: #424242;
        margin: 0 auto;
        padding: 0 14px;
        text-align: center;
        overflow: hidden;
    }
    h3 {
        text-align: center;
        line-height: 1.2;
        font-size: 12px;
        color: #d0d0d0;
        padding: 10px;
    }
}
</style>
